library(data.table)
library(ggplot2)
library(dplyr)
library(RColorBrewer)  
library(Cairo)
library(showtext)
library(dplyr)



df_hexmap<-read.csv("ChinaMapEN.csv",stringsAsFactors=FALSE)

# 需把csv文件换成自己需要的
df_province<-fread("df_province.csv")     

# 创建分组
car_province$group<-cut(car_province$value,breaks=c(0,0.5,10,20,30,40),labels=c('0','0~10','10~20','20~30','30~40'),order=TRUE,include.lowest = TRUE)


carplot<-left_join(car_hexmap,car_province)

ggplot()+
  geom_polygon(data=carplot, aes(x=x, y=y, group=Province, fill=group),colour="black",size=0.25)+  
  geom_text(data=carplot, aes(x=Centerx, y=Centery-0.01, group=Province,label=Province),size=4)+
  scale_fill_manual(values=rev(brewer.pal(5,'Spectral')))
